#ifndef _RELEASE_CP_HPP
#define _RELEASE_CP_HPP 1

#include "../Parameters.hpp"
#include "MacArrayMessage.hpp"

namespace BFT
{
	namespace messages
	{
		class ReleaseCP : public MacArrayMessage
		{
			public:
			
			ReleaseCP(boost::shared_ptr<char> _token, int _token_size, uint32_t _seqNo, uint32_t _sender);
			
			ReleaseCP(boost::shared_ptr<char> _bytes, int _bytes_size);
			
			int getTokenSize(); //inlined
			
			boost::shared_ptr<char> getToken(); //inlined
			
			boost::shared_ptr<char> getToken(int& _token_size); //inlined			
			
			uint32_t getSequenceNumber(); //inlined
			
			uint32_t getSendingReplica(); //inlined
			
			bool equals(boost::shared_ptr<ReleaseCP> _other_rcp);
			
			bool matches(boost::shared_ptr<VerifiedMessageBase> _other_vmb);
			
			static uint32_t computeSize(int _tonen_size);
			
			void printInfo();
			
			protected:
			
			boost::shared_ptr<char> token;
			int token_size;
			uint32_t seqNo;		
		};
		

		inline uint32_t ReleaseCP::getSendingReplica() {return getSender();}
		inline uint32_t ReleaseCP::getSequenceNumber() {return seqNo;}
		inline int ReleaseCP::getTokenSize() {return token_size;}
		inline boost::shared_ptr<char> ReleaseCP::getToken() {return token;}
		inline boost::shared_ptr<char> ReleaseCP::getToken(int& _token_size) {_token_size = token_size; return token;}
	}
}

#endif
